﻿using System;
using System.Collections.Generic;

namespace ClassLibrary1
{
    internal class NullPaySystem : IPaySystem
    {
        public void IncreaseProfit(int profit)
        {

        }
    }

    public interface IStore
    {
        int GetTotalAmout();
        void AddItem(Item book);
        List<Item> GetItems();
        void Sell(Item item);
    }

    public class Store : IStore
    {
        private List<Item> items = new List<Item>();
        private IPaySystem paySystem = new NullPaySystem();

        public int GetTotalAmout()
        {
            return items.Count;
        }

        public void AddItem(Item book)
        {
            if (book == null)
                throw new ArgumentNullException("book");

            items.Add(book);
        }

        public List<Item> GetItems()
        {
            return items;
        }

        public void Sell(Item item)
        {
            paySystem.IncreaseProfit(item.Price);
            items.Remove(item);
        }

        public void SetPaySystem(IPaySystem paySystem)
        {
            this.paySystem = paySystem;
        }
    }
}